home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5810 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  38 lines

  1. Newsgroups: comp.lang.c++
  2. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!cronkite!news
  3. From: Marco DeFreitas <mdefreitas@sikorsky.com>
  4. Subject: Overloading the "new" operator
  5. Content-Type: text/plain; charset=us-ascii
  6. Message-ID: <1996Feb6.215339.14166@cronkite.res.utc.com>
  7. Sender: news@cronkite.res.utc.com
  8. Nntp-Posting-Host: iris604.asi.sikorsky.com
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Sikorsky Aircraft
  11. Mime-Version: 1.0
  12. Date: Tue, 6 Feb 1996 21:53:39 GMT
  13. X-Mailer: Mozilla 1.1S (X11; I; IRIX 5.3 IP12)
  14. X-Url: news:comp.lang.c++
  15.  
  16. Hello,
  17.  
  18. I need to allocate some of my classes from shared memory.  I plan to
  19. overload the new operator to do this.  I intend to pre-allocate a chunk
  20. of shared memory initially, and then just feed people pointers into
  21. this chunck as requested.  These classes will not be deleted, so
  22. extensive memory management is not a concern.  However, my question is:
  23.  
  24. How can I give a valid pointer?  That is, if a class needs to start on a 
  25. word boundry and my last "new" left my shared memory pointer in the
  26. middle of a word, don't I have a problem?  Is it good enough to just
  27. make sure my pointer is on a double-word boundry at all times?  Is this
  28. method portable?  Is there a better way to do this?
  29.  
  30. Thanks for any input.
  31.  
  32. -- 
  33. Regards,
  34. Marco DeFreitas
  35. Sikorsky Aircraft
  36. Stratford, CT
  37.  
  38.